IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_EventLog_EventLogType]') AND parent_object_id = OBJECT_ID(N'[dbo].[EventLog]'))
BEGIN
     ALTER TABLE [dbo].[EventLog] DROP CONSTRAINT [FK_EventLog_EventLogType]
END
GO

ALTER TABLE [dbo].[EventLog] WITH CHECK ADD CONSTRAINT [FK_EventLog_EventLogType] 
     FOREIGN KEY([EventLogTypeId]) REFERENCES [dbo].[EventLogType] ([EventLogTypeId])
GO
